# import pojo.Announcement
# from app import mysql
# class Announcement(mysql.Model):
#     __tablename__ = 'announcement'  # 指定表名

from app import  mysql

from flask import Flask, request
from flask_sqlalchemy import SQLAlchemy



    # announcement_id = mysql.Column(mysql.String(10), primary_key=True)
    # type = mysql.Column(mysql.Enum("公告", "新闻"))
    # title = mysql.Column(mysql.String(20))
    # content = mysql.Column(mysql.Text)
    # publish_date = mysql.Column(mysql.Date)
class Announcement(mysql.Model):
    __tablename__ = 'announcement'

    announcement_id = mysql.Column(mysql.Integer, primary_key=True)
    type = mysql.Column(mysql.Enum("公告", "新闻"))
    title = mysql.Column(mysql.String(20))
    content = mysql.Column(mysql.Text)
    publish_date = mysql.Column(mysql.Date)


    def __init__(self,type,title,content,publish_date ):
        self.type =type;
        self.title =title;
        self.content =content;
        self.publish_date =publish_date;
        super().__init__()

    def __repr__(self):
        return f'<Announcement announcement_id = {self.announcement_id} type = {self.type} title = {self.title} content = {self.content} publish_date = {self.publish_date}>'